package com.app.brilliant.game.mapper;

import com.app.brilliant.game.response.WxUserListInfo;
import com.app.brilliant.game.vo.CourseProgressVO;
import com.app.brilliant.sys.params.WxUserListPageParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.app.brilliant.game.bean.WxUser;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
* @author GF
* @description 针对表【wx_user】的数据库操作Mapper
* @createDate 2025-07-25 10:21:53
* @Entity generator.game.WxUser
*/
@Repository
public interface WxUserMapper extends BaseMapper<WxUser> {
    WxUser selectByOpenid(@Param("openid") String openid);
    IPage<WxUserListInfo> wxUserList(@Param("page") Page page, @Param("param") WxUserListPageParam wxUserListPageParam);

    /**
     * 检查邮箱是否已注册
     * @param email 邮箱地址
     * @return 注册数量
     */
    int existsByEmail(@Param("email") String email);

    /**
     * 通过邮箱更新密码
     * @param email 邮箱地址
     * @param newPassword 新密码
     * @return 更新行数
     */
    int updatePasswordByEmail(@Param("email") String email, @Param("newPassword") String newPassword);

    List<CourseProgressVO> selectCourseProgressByUserId(@Param("userId") Integer userId);
}
